package com.PVZ.model.bullet;

import com.PVZ.model.Anime;
import com.PVZ.model.emuns.AnimeType;
import com.PVZ.model.emuns.BulletType;
import com.PVZ.model.emuns.MoveType;
import com.PVZ.model.interfaces.Gettable;
import com.PVZ.utils.Util;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.awt.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by @Author: kabuda on @Date: 2021/5/17 23:19
 * <p>
 * 特殊类型--阳光
 */
@Getter
@Setter
@NoArgsConstructor
public class Sun extends Bullet implements Gettable {

    //第几张图片
    private int imgId;

    private boolean isClick;

    /**
     * 移动方式
     * -1: 不移动
     * 1: 默认移动方式--向下移
     * 2: 拾取后的移动方式--往左上角移
     * 3:
     */
    // private MoveType moveType = MoveType.Stop;

    @Override
    public void setAnime() {
        Map<AnimeType, Anime> animeMap = new HashMap<>();

        String src = "res/img/bullet/sun";
        Anime anime = new Anime();
        anime.setAnimeSrc(src);
        anime.setAnimeIndex(0);
        anime.setAnimePlayMode(-1);
        int startIndex = 1;
        int endIndex = 12;

        List<String> animeList = Util.addImageToList(startIndex, endIndex, src,"sun");

        anime.setAnimeList(animeList);

        //设置当前显示动画的地址
        anime.setCurPic(animeList.get(0));

        animeMap.put(AnimeType.MOVE, anime);

        setAnimeMap(animeMap);

    }

    public Sun(Point point,MoveType moveType) {
        super(point,moveType,BulletType.Sun);
        this.setHealth(1);
        this.setImgSrc("res/img/bullet/sun/sun-1.png");
        this.setCurSpeed(5);

        this.setReviseX(20);
        this.setReviseY(15);

        setAnime();
    }
}
